import Vue from 'vue'
import Component from 'vue-class-component'

import { State, Getter, Action, Mutation, namespace } from 'vuex-class'

// 以他们的名字注册路由器钩子
Component.registerHooks([
  'beforeRouteEnter',
  'beforeRouteLeave',
  'beforeRouteUpdate' // for vue-router 2.2+
])

@Component({
  template: require('./app.html')
})
export default class AppComponent extends Vue {
  message: string = 'parent message'

  beforeRouteEnter () {
    console.log('beforeRouteEnter')
  }

  beforeRouteLeave () {
    console.log('beforeRouteLeave')
  }

  beforeRouteUpdate () {
    console.log('beforeRouteUpdate')
  }

  // @State('count') count: any;
  // @Action('count') actionCount: any;
  // @Mutation('count') mutationCount: any;
  //
  // asyncData (store: any, route: any) {
  //
  //   // 触发 action 后，会返回 Promise
  //   return store.dispatch('increment')
  // }
  //
  // onCountAction () {
  //   this.message = 'change message';
  //   console.log('message change')
  //   // this.actionCount('increment')
  // }
}
